package cn.itcast.bos.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import cn.itcast.bos.domain.base.Standard;

/*
 * 参数1:实体类
 * 参数2:实体类中主键的类型
 * 
 */
public interface StandardRepository extends JpaRepository<Standard, Integer>{
	
	//find+By+实体类中属性名称,符合规范就能查询
	List<Standard> findByName(String name);

	List<Standard> findByNameLike(String name);
	
	@Query(value="from Standard where name = ?")
	List<Standard> queryName(String name);
	
	@Query
	List<Standard> queryName1(String name);
	
	@Query(value="update Standard set minLength = ?2 where id = ?1")
	@Modifying
	void updateMinLength(int id, int minLength);
	
}
